<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title _msttexthash="12489139" _msthash="0">逛水果店</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        div {
            text-align: center;
        }
        
        table {
            margin: 0 auto
        }
        
        tr td {
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="app">
        <h4>欢迎光临_vue开发的收银系统_水果店</h4>
        <table border="1" width="600" height="100">
            <tr>
                <td>
                    <p>苹果10￥/斤,折扣
                        <8折>
                    </p>
                </td>
            </tr>
            <tr>
                <td>
                    <span>请输入你要购买的斤数</span>
                    <input type="number" v-model="kg">
                </td>
            </tr>
            <tr>
                <td>
                    <button @click="payMoney">结账买单~</button>
                </td>
            </tr>
            <tr>
                <td>
                    <p>结账单：总价：{{price}}元 折后价：{{price * 0.8}}元 省了：{{price * 0.2}}元</p>
            </tr>
        </table>
    </div>
    <script src="../vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                kg: 0,
                price: 0
            },
            methods: {
                payMoney() {
                    this.price = this.kg * 10
                }
            }
        })
    </script>
</body>

</html>